/*
 * @Author: lixudong 1164391645@qq.com
 * @Date: 2025-04-07 08:44:01
 * @LastEditors: lixudong 1164391645@qq.com
 * @LastEditTime: 2025-04-07 08:48:34
 * @FilePath: \clear-system-ruoyi\src\utils\storage.js
 * @Description:
 */
export const saveRecentRoutes = routes => {
  try {
    localStorage.setItem('hmClearRecentRoutes', JSON.stringify(routes.slice(0, 10))) // 截取前10条
  } catch (error) {
    console.error('Failed to save recent routes:', error)
  }
}

export const getRecentRoutes = () => {
  try {
    const storedRoutes = localStorage.getItem('hmClearRecentRoutes')
    return storedRoutes ? JSON.parse(storedRoutes) : []
  } catch (error) {
    console.error('Failed to retrieve recent routes:', error)
    return []
  }
}
